import http from '../request.js'
/* 
订单控制类
*/

export function getOrderInfo(data) {
  return http.request({
    url: '/order/getOrderInfo',
    method: 'get',
    data
  })
}

export function grabOrders(data) {
  return http.request({
    url: '/order/grabOrders',
    method: 'get',
    data
  })
}

// 修改订单状态
export function modifyOrderStatus(data) {
  return http.request({
    url: '/admin/order/updateOrderStatus',
    method: 'post',
    data
  })
}

export function nurseCancelOrder(data) {
  return http.request({
    url: '/order/nurseCancelOrder',
    method: 'post',
    data
  })
}

export function nurseSelectOrderInfo(data) {
  return http.request({
    url: '/order/nurseSelectOrderInfo',
    method: 'get',
    data
  })
}
export function nurseSelectOrderListByState(data) {
  return http.request({
    url: '/order/nurseSelectOrderListByState',
    method: 'get',
    data
  })
}
export function selectHomeOrdersByDto(data) {
  return http.request({
    url: '/order/selectHomeOrdersByDto',
    method: 'post',
    data
  })
}
export function selectNurseIsFreedom(data) {
  return http.request({
    url: '/order/selectNurseIsFreedom',
    method: 'get',
    data
  })
}
export function selectOrderAddressByNurseId(data) {
  return http.request({
    url: '/order/selectOrderAddressByNurseId',
    method: 'get',
    data
  })
}
export function selectOrderByNurseId(data) {
  return http.request({
    url: '/order/selectOrderByNurseId',
    method: 'get',
    data
  })
}
export function updateOrderIsException(data) {
  return http.request({
    url: '/order/updateOrderIsException',
    method: 'get',
    data
  })
}
export function updateServeTime(data) {
  return http.request({
    url: '/order/updateServeTime',
    method: 'get',
    data
  })
}

// 后台订单管理类
// 分配护士
export function riderOrder(number, nurseId) {
  return http.request({
    url: '/admin/order/riderOrder?number=' + number + '&nurseId=' + nurseId,
    method: 'get'
  })
}
// 根据订单查询处理记录
export function selectAbnormalByNumber(data) {
  return http.request({
    url: '/admin/order/selectAbnormalByNumber?number=' + data,
    method: 'get'
    // data
  })
}
// 查询所有可分配护士
export function selectAllOkNurse(data) {
  return http.request({
    url: '/admin/order/selectAllOkNurse',
    method: 'post',
    data
  })
}
// 查询所有的订单信息
export function selectAllOrder(data) {
  return http.request({
    url: '/admin/order/selectAllOrder',
    method: 'post',
    data
  })
}
// 查询订单所有id
export function selectAllOrderIds(data) {
  return http.request({
    url: '/admin/order/selectAllOrderIds',
    method: 'post',
    data
  })
}

// 查看建档档案
export function selectHealthFileById(data) {
  return http.request({
    url: '/admin/order/selectHealthFileById?healthId=' + data,
    method: 'get'
  })
}

// 查询护理报告
export function selectNursingRecordByNumber(number) {
  return http.request({
    url: '/admin/order/selectNursingRecordByNumber?number=' + number,
    method: 'get'
  })
}

// 查询订单详情
export function selectOneOrder(data) {
  return http.request({
    url: '/admin/order/selectOneOrder?number=' + data,
    method: 'get'
    // data
  })
}

// 更新子订单服务时间
export function updateServiceTimeByNumber(number, time) {
  return http.request({
    url: 'admin/order/updateServiceTimeByNumber?number=' + number + '&time=' + time,
    method: 'get'
  })
}

// 查询子订单详情
export function selectSonOrderInfo(number, status) {
  return http.request({
    url: 'admin/order/selectSonOrderInfo?number=' + number + '&status=' + status,
    method: 'get'
  })
}

// 退款订单控制类
/* 普通订单退款 */
/* 
所有退款订单查询
*/
export function selectAllRefundOrder(data) {
  return http.request({
    url: '/admin/cancelOrder/selectAllRefundOrder',
    method: 'post',
    data
  })
}

/* 费森尤斯订单退款 */
/* 
所有退款订单查询
*/
export function selectFreseniusRefundOrder(data) {
  return http.request({
    url: 'admin/cancelOrder/selectFreseniusRefundOrder',
    method: 'post',
    data
  })
}
/* 
所有退款订单id查询
*/
export function selectAllRefundOrderIds(data) {
  return http.request({
    url: 'admin/cancelOrder/selectAllRefundOrderIds',
    method: 'post',
    data
  })
}

/* 
查看退款订单详情
*/
export function selectOneRefundOrder(data) {
  return http.request({
    url: '/admin/cancelOrder/selectOneRefundOrder?number=' + data,
    method: 'get'
  })
}
/* 
查看费森尤斯订单详情
*/
export function selectFreseniusRefundOrderDetail(params) {
  return http.request({
    url: '/admin/cancelOrder/selectFreseniusRefundOrderDetail',
    method: 'get',
    params
  })
}
/* 
查看退款设置
*/
export function selectRefundOrderSet(data) {
  return http.request({
    url: '/admin/cancelOrder/selectRefundOrderSet',
    method: 'get',
    data
  })
}

/* 
修改退款设置
*/
export function updateRefundOrderSet(data) {
  return http.request({
    url: '/admin/cancelOrder/updateRefundOrderSet',
    method: 'post',
    data
  })
}

// 待接单状态取消订单
export function cancelOrder(data) {
  return http.request({
    url: '/admin/cancelOrder/adminCancelOrder?number=' + data,
    method: 'get'
  })
}
// 不填写原因退款
export function confirmRefund(data) {
  return http.request({
    url: '/admin/cancelOrder/manageRefund',
    method: 'get',
    params: data
  })
}
// 一期优化后的退款
export function adminCancelOrder(data) {
  return http.request({
    url: 'admin/cancelOrder/adminCancelOrder',
    method: 'get',
    params: data
  })
}
/*
填写退款原因处理退款
*/
export function ProcessCancelOrder(data) {
  return http.request({
    url: '/admin/cancelOrder/manageRefund?number=' + data.number + '&status=' + data.status + '&content=' + data.content,
    method: 'get'
  })
}

/* 
线下订单3.30

*/

// 查询所有订单
export function selectAll(data) {
  return http.request({
    url: '/admin/offlineorder/selectAll',
    method: 'post',
    data: data
  })
}

// 查询线下核对订单
export function selectAllNew(data) {
  return http.request({
    url: '/admin/offlineorder/selectAll/new',
    method: 'post',
    data: data
  })
}

// 导入线下订单
export function importExcel(data) {
  return http.request({
    url: '/admin/offlineorder/import',
    method: 'post',
    data: data
  })
}

// 查询线下核对所有id
export function selectAllNewIds(data) {
  return http.request({
    url: 'admin/offlineorder/selectAll/newIds',
    method: 'post',
    data: data
  })
}

export function saveOrUpdateOld(data) {
  return http.request({
    url: '/admin/offlineorder/saveOrUpdate',
    method: 'post',
    data: data
  })
}
export function onKeyAllot(data) {
  return http.request({
    url: '/admin/offlineorder/onKeyAllot',
    method: 'post',
    data: data
  })
}

// 新增或修改订单

export function saveOrUpdate(data) {
  return http.request({
    url: '/admin/offlineorder/saveOrUpdate/new',
    method: 'post',
    data: data
  })
}

// 修改线下订单实际金额
export function editOrderPrice(data) {
  return http.request({
    url: '/admin/offlineorder/updatePrice',
    method: 'post',
    data: data
  })
}

// 查询订单详情
export function selectOne(id) {
  return http.request({
    url: '/admin/offlineorder/selectOne?id=' + id,
    method: 'post'
  })
}

/*
2022.4.29新增上门核酸订单类 
*/
export function createOrder(data) {
  return http.request({
    url: '/admin/smhsorder/createOrder',
    method: 'post',
    data: data
  })
}
export function selectPromotionOrder(data) {
  return http.request({
    url: '/admin/smhsorder/selectAllOrder',
    method: 'post',
    data: data
  })
}

export function selectById(data) {
  return http.request({
    url: '/admin/smhsorder/selectById',
    method: 'post',
    data: data
  })
}

export function deleteOrder(data) {
  return http.request({
    url: '/admin/smhsorder/deleteOrder?id=' + data,
    method: 'get',
    data: data
  })
}
// 退款
export function cancelById(status, id) {
  return http.request({
    url: '/admin/smhsorder/cancelById?status=' + status + '&id=' + id,
    method: 'get'
  })
}

// 查询所有街道信息
export function selectAllshName(xzName) {
  if (xzName) {
    var url = '/admin/smhsorder/selectAllshName?xzName=' + xzName
  } else {
    var url = '/admin/smhsorder/selectAllshName'
  }
  return http.request({
    url: url,
    method: 'get'
  })
}

export function payOrder(data) {
  return http.request({
    url: '/admin/offlineorder/settlement',
    method: 'post',
    data: data
  })
}

export function offlineorder(data) {
  return http.request({
    url: '/admin/offlineorder/Clearing',
    method: 'post',
    data: data
  })
}

export function createOnlineOrder(data) {
  return http.request({
    url: '/admin/order/createOnlineOrder',
    method: 'post',
    data: data
  })
}

export function selectServiceInfoById(data) {
  return http.request({
    url: '/admin/good/selectServiceInfo',
    method: 'get',
    data: data
  })
}
export function selectAllOrderExport(data) {
  return http.request({
    url: '/admin/order/selectAllOrderExport',
    method: 'post',
    data: data
  })
}

export function updateOtherInfo(data) {
  return http.request({
    url: 'admin/order/updateOtherInfo',
    method: 'get',
    params: data
  })
}

// 订单处理记录
export function selectOrderLog(data) {
  return http.request({
    url: 'admin/order/selectOrderLog',
    method: 'get',
    params: data
  })
}

export function calleeRecordByNumber(data) {
  return http.request({
    url: 'admin/order/calleeRecordByNumber',
    method: 'get',
    params: data
  })
}

// 机构
export function queryOrganList(data) {
  return http.request({
    url: 'admin/organOrderDetail/queryOrganList',
    method: 'get',
    params: data
  })
}
export function updatePeopleMobile(data) {
  return http.request({
    url: 'admin/order/updatePeopleMobile',
    method: 'get',
    params: data
  })
}
export function selectPeopleMobile(data) {
  return http.request({
    url: 'admin/order/selectPeopleMobile',
    method: 'get',
    params: data
  })
}

// 修改抢单状态
export function updateOrderIsShow(data) {
  return http.request({
    url: 'admin/order/updateOrderIsShow',
    method: 'get',
    params: data
  })
}
export function selectAdminConfigurationByServiceId(data) {
  return http.request({
    url: '/admin/configuration/selectAdminConfigurationByServiceId',
    method: 'get',
    params: data
  })
}

export function organOrderAllocation(data) {
  return http.request({
    url: 'admin/organOrderDetail/organOrderAllocation',
    method: 'post',
    data: data
  })
}

export function selectHeartCard(data) {
  return http.request({
    url: 'admin/heartCard/selectHeartCard',
    method: 'post',
    data: data
  })
}
// 导出
export function cancelOrderUpload(data) {
  return http.request({
    url: '/admin/cancelOrder/cancelOrderUpload',
    method: 'post',
    data: data
  })
}

// 线下核算数据导出
export function selectAllOfflineOrderExport(data) {
  return http.request({
    url: 'admin/offlineorder/selectAllOfflineOrderExport',
    method: 'post',
    data: data
  })
}

// 订单三公里推送
export function pushOrderDistance() {
  return http.request({
    url: 'admin/order/pushOrderDistance',
    method: 'get'
  })
}

export function closeOrderMessage(params) {
  return http.request({
    url: 'admin/order/closeOrderMessage',
    method: 'get',
    params
  })
}

// 跳过位置判断
export function skipTargeting(params) {
  return http.request({
    url: 'admin/order/skipTargeting',
    method: 'get',
    params
  })
}

// 上传导入订单列表
export function uploadOrder(data) {
  return http.request({
    url: 'admin/order/uploadOrder',
    method: 'post',
    data
  })
}

// 批量导入线上订单
export function importOrder(params) {
  return http.request({
    url: 'admin/order/importOrder',
    method: 'get',
    params
  })
}
